import mongoose from '../dbHelper';
import {defaultSchemaExtend, defaultSchemaOptions} from "../config/index";

const Schema = mongoose.Schema;

const DlyUserSchema = new Schema(Object.assign({
  userName: String,
  phone: {
    type: String,
    unique: true,
    required: true,
    length: 11
  },
  password: {
    type: String,
    // required: true,
    // maxlength: 16
  },
  // 剩余积分
  remainScore: {
    type: Number,
    default: 0
  },
  // 送的剩余积分
  remainSendScore: {
    type: Number,
    default: 0
  },
  // 剩余次数
  remainCount: {
    type: Number,
    default: 0
  },
  // 送的剩余次数
  remainSendCount: {
    type: Number,
    default: 0
  },
  buyGoodsList: {
    type: Array,
    default: []
  }

}, defaultSchemaExtend), defaultSchemaOptions);

const DlyUser = mongoose.model('DlyUser', DlyUserSchema, 'DlyUsers');

export default DlyUser